package com.tx365.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;
import android.util.Log;
 
import java.util.HashMap;

public class PreferencesWrapper
{

  //@Signature({"Ljava/util/HashMap", "<", "Ljava/lang/String;", "Ljava/lang/Boolean;", ">;"})
 
  public static final String DEFAULT_MY_NUMBER = "pre_my_number";
  public static final String DIAL_PRESS_TONE_MODE = "pre_dial_press_tone_mode";
  public static final String DIAL_PRESS_VIBRATE_MODE = "pre_dial_press_vibrate_mode";
  public static final String IS_AUTO_LOGIN = "auto_login";
  class PreferencesWrapper$1 extends HashMap
  {
    private static final long serialVersionUID = 1L;
  }
  // @Signature({"Ljava/util/HashMap", "<", "Ljava/lang/String;", "Ljava/lang/String;", ">;"})
  private static final HashMap BOOLEAN_PREFS = null;
private static final HashMap STRING_PREFS = null;
  private static final String THIS_FILE = "PreferencesWrapper";
  private Context context;
  private SharedPreferences prefs;

  
 
  public PreferencesWrapper(Context paramContext)
  {
    this.context = paramContext;
    SharedPreferences localSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.context);
    this.prefs = localSharedPreferences;
  }

  private static Boolean gPrefBooleanValue(SharedPreferences paramSharedPreferences, String paramString)
  {
//    {boolean bool = BOOLEAN_PREFS.containsKey(paramString);
//    if (bool)
//      bool = ((Boolean)BOOLEAN_PREFS.get(paramString)).booleanValue();
//    for (Boolean localBoolean = Boolean.valueOf(paramSharedPreferences.getBoolean(paramString, bool)); ; localBoolean = Boolean.valueOf(null))
//      return localBoolean;
      return paramSharedPreferences.getBoolean(paramString, true);
  }

  private static String gPrefStringValue(SharedPreferences paramSharedPreferences, String paramString)
  { 
//    boolean bool = STRING_PREFS.containsKey(paramString);
//    String str = null;
////    if (bool)
////      str = (String)STRING_PREFS.get(paramString);
    String str = paramSharedPreferences.getString(paramString, "");  
    return str;
  }

  public Boolean getPreferenceBooleanValue(String paramString)
  {
    return gPrefBooleanValue(this.prefs, paramString);
  }

  public int getPreferenceIntegerValue(String paramString)
  {
    int i;
    try
    {
      i = Integer.parseInt(getPreferenceStringValue(paramString));
      return i;
    }
    catch (NumberFormatException localNumberFormatException)
    {
      String str = "Invalid " + paramString + " format : expect a int";
      Log.e("PreferencesWrapper", str);
      i = Integer.parseInt((String)STRING_PREFS.get(paramString));
    }
    return i;
  }

  public String getPreferenceStringValue(String paramString)
  {
    return gPrefStringValue(this.prefs, paramString);
  }

  public void setPreferenceBooleanValue(String paramString, Boolean paramBoolean)
  {
    SharedPreferences.Editor localEditor = this.prefs.edit();
    boolean bool = paramBoolean.booleanValue();
    localEditor.putBoolean(paramString, bool);
    localEditor.commit();
  }

  public void setPreferenceStringValue(String paramString1, String paramString2)
  {
    SharedPreferences.Editor localEditor = this.prefs.edit();
    localEditor.putString(paramString1, paramString2);
    localEditor.commit();
  }
}
 